package cz.ujep.ki.emap;

import org.json.JSONException;
import org.json.JSONObject;

public class TopoEmotion {
	static final int CATEGORY_PEOPLE 	= 0;
	static final int CATEGORY_NATURE 	= 1;
	static final int CATEGORY_CULTURE	= 2;

	long sid;
	double longitude;
	double latitude;	
	int category;
	boolean liked;
	double accuracy;
	
	public TopoEmotion(long sid, double longitude, double latitude, 
			int category, boolean like, double accuracy) {
		this.sid = sid;
		this.longitude = longitude;
		this.latitude = latitude;
		this.category = category;
		this.liked = like;
		this.accuracy = accuracy;
	}
	
	public TopoEmotion(JSONObject json) throws JSONException {
		this.sid = json.getLong("sid");
		this.longitude = json.getDouble("longitude");
		this.latitude = json.getDouble("latitude");
		this.category = json.getInt("category");
		this.liked = json.getBoolean("liked");
		this.accuracy = json.getDouble("accuracy");
	}
	
	public JSONObject toJSON() throws JSONException{
		JSONObject json = new JSONObject();
		
		json.put("sid", this.sid);
		json.put("longitude", this.longitude);
		json.put("latitude", this.latitude);
		json.put("category", this.category);
		json.put("liked", this.liked);
		json.put("accuracy", this.accuracy);
		return json;
	}
}


